﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Job.Web.Framework
{
    public class Constants
    {
        public const string RT_BaseContentManager = "01";  //基本内容管理
        public const string RT_HunterJobManager = "02";    //猎头职位管理
        public const string RT_AdminUserManager = "03";    //系统用户管理
        public const string RT_PersonManage = "04";        //求职者管理
        public const string RT_CompanyManage = "05";       //企业管理
        public const string RT_DictionaryManage = "06";    //数据字典

        private static List<KeyValuePair<String,String>> AdminRights = null ;

        public static List<KeyValuePair<String,String>> GetAdminRights() 
        {
            if ( null == AdminRights ) 
            {
                List<KeyValuePair<String,String>> items 
                    = new List<KeyValuePair<String,String>>();
                items.Add(new KeyValuePair<String,String>(RT_BaseContentManager,"网站内容管理"));
                items.Add(new KeyValuePair<String, String>(RT_HunterJobManager, "猎头职位管理"));
                items.Add(new KeyValuePair<String, String>(RT_AdminUserManager, "系统用户管理"));

                items.Add(new KeyValuePair<String,String>(RT_PersonManage,"求职者管理"));
                items.Add(new KeyValuePair<String, String>(RT_CompanyManage, "注册企业管理"));
                items.Add(new KeyValuePair<String, String>(RT_DictionaryManage, "数据字典管理"));

                AdminRights = items;
            }
            return AdminRights;
        }


        public enum UserType
        {
            PersonalUser    =1,
            CompanyUser     =2,
            WebSiteAdmin    =3
        }

        //一级栏目所对应的ID，一级栏目叫 Category
        public enum CategoryType
        {
            HomePage = 0,       //首页
            Company = 10,       //无忧资讯
            Hunter = 11,       //猎头专区
            Service = 12,        //人事外包
            Person = 1,        //个人求职
            Job = 2         //企业招聘
        }


        //二级栏目所对应的ID，二级栏目叫 Subject
        public enum SubjectType
        {
            CompanyNews = 100,          //无忧新闻
            CompanyDescription = 101,   //关于无忧
            CompanyBBS = 102,           //无忧论坛
            CompanyContactMethod = 103, //联系我们
            CompanyFastList = 104,      //无忧快讯列表
            CompanyFastInfo = 105,      //无忧快讯编辑
            CompanyHRList = 106,        //HR频道列表
            CompanyHRInfo = 107,        //HR频道编辑
            CompanyManagerList = 108,   //管理资讯列表
            CompanyManagerInfo = 109,   //管理资讯编辑
            CompanyIndustryList = 301,  //行业动态列表
            CompanyIndustryInfo = 302,  //行业动态编辑
            
            HunterDescription = 110,    //猎头说明
            HunterPositionList = 111,   //猎头职位列表
            HunterPositionIfo = 112,    //猎头职位编辑
            HunterNewsList = 113,       //猎头资讯列表
            HunterNewsInfo = 114,       //猎头资讯编辑
            HunterManagerAreaList = 117,    //猎头管理专区列表
            HunterManagerAreaInfo = 118, //猎头管理专区编辑
            HunterContactMethod = 116,  //猎头联系方式

            ServiceDescription = 120,       //人事外包业务说明
            ServiceSuggestion = 121,        //人事外包解决方案
            ServiceQuestionList = 122,      //人事外包政策咨询列表
            ServiceQuestionInfo = 123,      //人事外包政策咨询编辑
            ServiceAnalysisList = 124,      //人事外包案例分析列表
            ServiceAnalysisInfo = 125,      //人事外包案例分析编辑
            ServiceContactMethod = 126,     //人事外包联系方式

            OtherFriendLink = 150,      //友情链接
            OtherPersonHelp = 151,      //个人帮助
            OtherCompanyHelp = 152,     //企业帮助
            OtherCustomerCenter = 153,  //客户中心
            AdvanceCustomer     = 154,   //LOGO管理
            AdvanceCustomerList = 155,  //LOGO列表

            AdminManagerList = 200,                //系统管理员列表
            AdminManagerInfo = 201,                 //系统管理员编辑
            AdminChangePassword = 202,          //更改密码

            CompanySearcher = 30,            //管理员搜索个人
            PersonSearhcer1 = 31               //管理员搜索企业
        }

        //根据列表的ID，查询详细页面所对应的ID
        public static int GetInfoIdByListId(int listValue)
        {
            switch (listValue)
            {
                //猎头资讯的转换
                case (int)SubjectType.HunterNewsList:
                    return (int)SubjectType.HunterNewsInfo;
                //人事外包政策咨询转换
                case (int)SubjectType.ServiceQuestionList:
                    return (int)SubjectType.ServiceQuestionInfo;
                //人事外包案例分析转换
                case (int)SubjectType.ServiceAnalysisList:
                    return (int)SubjectType.ServiceAnalysisInfo;
                case (int)SubjectType.CompanyFastList:
                    return (int)SubjectType.CompanyFastInfo;
                case (int)SubjectType.CompanyHRList:
                    return (int)SubjectType.CompanyHRInfo;
                case (int)SubjectType.CompanyIndustryList:
                    return (int)SubjectType.CompanyIndustryInfo;
                case (int)SubjectType.CompanyManagerList:
                    return (int)SubjectType.CompanyManagerInfo;
                case (int)SubjectType.HunterManagerAreaList:
                    return (int)SubjectType.HunterManagerAreaInfo;
                case (int)SubjectType.AdvanceCustomerList:
                    return (int)SubjectType.AdvanceCustomer;
                default:
                    return listValue;
            }
        }

        //根据详细页面所对应的ID，查询列表的ID
        public static int GetListIdByInfoId(int itemValue)
        {
            switch (itemValue)
            {
                //猎头资讯的转换
                case (int)SubjectType.HunterNewsInfo:
                    return (int)SubjectType.HunterNewsList;
                //人事外包政策咨询转换
                case (int)SubjectType.ServiceQuestionInfo:
                    return (int)SubjectType.ServiceQuestionList;
                //人事外包案例分析转换
                case (int)SubjectType.ServiceAnalysisInfo:
                    return (int)SubjectType.ServiceAnalysisList;
                case (int) SubjectType.CompanyFastInfo:
                    return (int)SubjectType.CompanyFastList;
                case (int)SubjectType.CompanyHRInfo:
                    return (int)SubjectType.CompanyHRList;
                case (int)SubjectType.CompanyIndustryInfo:
                    return (int)SubjectType.CompanyIndustryList;
                case (int)SubjectType.CompanyManagerInfo:
                    return (int)SubjectType.CompanyManagerList;
                case (int)SubjectType.HunterManagerAreaInfo:
                    return (int)SubjectType.HunterManagerAreaList;
                case (int)SubjectType.AdvanceCustomer:
                    return (int)SubjectType.AdvanceCustomerList;
                default:
                    return itemValue;
            }
        }

        #region 字典管理所需要的参数
        //所有需要建立数据字典的类型
        public enum DictionaryType
        {
            PERSON_NATIONALITY = 1,     //民族，如：汉，苗，土家
            MARRY_STATE = 2,            //婚姻状态，如：未婚，已婚 
            ADDR_CITY = 3,              //地区 ，如：广东省，深圳市，广州市。两级结构
            EDUCATION_LEVEL = 4,        //文化程度，如：小学，初中，高中
            SPECIALTY_CLASS = 5,        //专业，如：计算机，电子
            TECH_TITLE = 6,             //职称，如：初级技工，高级技工
            FOREIGN_LANG = 7,           //外语种类，如：英语，日语
            LANG_SKILL = 8,             //语言熟练程度，如：一般，熟练，精通
            LANG_CERTIFY = 9,           //语言证书，如：英语四级，英语六级
            INDUSTRY_CLASS = 10,        //行业类别，如：制造业，电子制造。两级结构
            SALARY_LEVEL = 11,          //工资范围，如：1000元以下，1000-1300元
            PERSON_CLASS = 12,          //个人级别后台划分，如：一般，中级技工，高级技工
            POSITION_CLASS = 13,        //职位类别，如：计算机，软件开发。两级结构
            EAT_ROOM = 14,              //食宿条件，如：提供午餐，提供食宿
            COMPANY_PROPERTY = 15,      //企业性质，如：个人，私营，股分有限公司
            COMPANY_SCOPE = 16,         //企业规模，如：50人以下，50-100人
            CURRENT_WORKSTATUS = 17,    //个人当前工作状态，如：在职，离职
            APPLY_TYPE = 18,             //个人求职类型，如：全职，兼职
            PARTICIPATE_LEN = 19,        //离职时间，也即是入职时间，如：10天，30天
            IT_ABILITY = 20,             //IT技能，两络结构，如软件开发，网站开发
            CERTIFICATE_NAME = 21        //证书名称，如，财务方面，注册会计师，两级结构

        }

        //能过4位的子级代码取父级代码
        public static string GetParentCodeBySubCode(string subCode)
        {
            if (subCode == null)
            {
                return string.Empty;
            }
            if (subCode.Trim().Length < 4)
            {
                return subCode;
            }
            else
            {
                return subCode.Substring(0, 2);
            }
        }

        //得到两位的字典类型
        public static String GetDictionaryCode(DictionaryType type)
        {
            return Num2FixLenStr((int)type,DICT_CLASS_LEN);
        }

        //将一个数字转为固定长度的字符串，不足位时，前面补0，超过固定长度时 ，返回所有内容
        public static String Num2FixLenStr(int value,int len)
        {
            string str = value.ToString();
            if (str.Length >= len) return str;
            StringBuilder buf = new StringBuilder("0", len);
            buf.Append(str);
            return buf.ToString().Substring(buf.Length - len);
        }

        public const int DICT_CLASS_LEN = 2;    //字典类别的长度
        public const string EMPTY_FATHER = ""; //如果字典中无上一级，指定两个空格

        #endregion

        #region 个人简历左边的栏目设置
        public enum ResumeSubject
        {
            BaseInfo =  1,
            Education   = 2,
            WorkExperience  =   3,
            Train   = 4,
            Language    =5,
            //Certification = 6,
            CareerObjective = 6,
            PersonDesc = 7,
            //Attachments = 8,
            OtherDesc = 8,
            BrowseResume = 9,
            ForeignResume = 10,
            UploadPhoto     = 11,
            Security    = 12,
            Certification = 13,
            AdvanceHR = 14,
            ProjectExperience = 15,
            ITSkill = 16
            //CreateResume = 100
        }

        public enum ResumeManagerType
        {
            CreateResume = 1,
            ResumeCenter = 2,
            HunterSearch = 3,   //搜索猎头职位
            SendHistory = 4,     //简历发送历史
            FavoritesHistory = 5, //个人收藏            
            AccountModify = 6,       //休息个人账号
            PasswordEdit = 7 //修改密码
        }

        #endregion


        #region 企业管理左边的栏目设置
        public enum CompanySubject
        {
            CompanyView = 1,  //资料预览
            BaseInfo = 2,   //基本资料
            CompanyIntro = 3, //公司介绍
            ProductIntro = 4, //产品介绍
            CompanyLogo = 5, //企业Logo
            JobPosition = 6, //招聘职位
            PasswordEdit = 7 //修改密码
        }
        #endregion
    }
}
